//
//  KSRaiseUpFilterV.swift
//  SlaughterClient
//
//  Created by 邱仙凯 on 2021/9/15.
//  Copyright © 2021 aowang. All rights reserved.
//

import UIKit

class KSRaiseUpFilterV:KSBaseFilterV {
    override func layoutContentV() {
        tableAndConfirmV.frame = CGRect(x:0,y:KSGlobal.screenH,width: KSGlobal.screenW,height: self.appearance.bgHeight)
        tableAndConfirmV.setMutiBorderRoundingCorners(corner: [.topLeft,.topRight], number: 12)
        self.tableView?.reloadData()
    }
    // 添加到父控件上
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
   
//    override func willMove(toSuperview newSuperview: UIView?) {
        
//        if newSuperview.isSome {
            UIView.animate(withDuration: 0.2) { //  出现时
                self.tableAndConfirmV.ks_y = KSGlobal.screenH - self.appearance.bgHeight
                self.bottomCover.backgroundColor = UIColor.black.withAlphaComponent(0.6)
            }
//        }
        
    }
    
    @objc override func close(){
        UIView.animate(withDuration: 0.2) {
            self.tableAndConfirmV.ks_y = KSGlobal.screenH
            self.bottomCover.backgroundColor = .clear
        }
        
        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.2) {
            self.dismiss(animated:false )
        }
        if let clo = self.closeClosure {
            clo()
        }
        
    }
}
 
